package com.pipi.sso.dao.manager.impl;

import com.pipi.sso.dao.manager.CollegeManager;
import com.pipi.sso.dao.mapper.ext.CollegeExtMapper;
import com.pipi.sso.dao.model.CollegeDO;
import com.pipi.sso.dao.query.CollegeQuery;
import com.pipi.sso.dao.support.PageResult;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for College.
 */

@Component
public class CollegeManagerImpl implements CollegeManager {

    
    @Autowired
    protected CollegeExtMapper collegeExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(CollegeQuery query){
        return collegeExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(CollegeQuery query){
        return collegeExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(CollegeDO record){
        return collegeExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(CollegeDO record){
        return collegeExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<CollegeDO> selectByQuery(CollegeQuery query){
        return collegeExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<CollegeDO> selectByQueryWithPage(CollegeQuery query) {
        PageResult<CollegeDO> result = new PageResult<CollegeDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public CollegeDO selectByPrimaryKey(Long id){
        return collegeExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( CollegeDO record,  CollegeQuery query){
        return collegeExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( CollegeDO record,  CollegeQuery query){

        return collegeExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(CollegeDO record){
        return collegeExtMapper.updateByPrimaryKeySelective(record);
    }
}